package com.example.vueblog_java.common.lang;

import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * date 2022年08月07日 13:27
 */
@Data
@AllArgsConstructor
public class Result {
    private int code;// 200是正常，非200表示异常
    private String msg;
    private Object data;
    public static Result success(Object data){
        return success(200,"操作成功", data);
    }
    public static Result success(int code,String msg, Object data){
        return  new Result(code,msg,data);
    }
    public static Result failure(String msg){
        return failure(400, msg, null);
    }
    public static Result failure(String msg, Object data) {
        return failure(400, msg, data);
    }
    public static Result failure(int code,String msg, Object data){
        return  new Result(code,msg,data);
    }

}
